package cn.edu.hizee.gps.model;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "t_user_device", schema = "EHelp", catalog = "")
public class UserDevice {
    private int id;
    private Integer userId;
    private Integer deviceId;
    private String time;
    private Integer isBind;
    private Integer extra;

    public UserDevice(Integer userId, Integer deviceId, String time, Integer isBind, Integer extra) {
        this.userId = userId;
        this.deviceId = deviceId;
        this.time = time;
        this.isBind = isBind;
        this.extra = extra;
    }

    public UserDevice() {
    }

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user_id")
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "device_id")
    public Integer getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(Integer deviceId) {
        this.deviceId = deviceId;
    }

    @Basic
    @Column(name = "time")
    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Basic
    @Column(name = "is_bind")
    public Integer getIsBind() {
        return isBind;
    }

    public void setIsBind(Integer isBind) {
        this.isBind = isBind;
    }

    @Basic
    @Column(name = "extra")
    public Integer getExtra() {
        return extra;
    }

    public void setExtra(Integer extra) {
        this.extra = extra;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserDevice that = (UserDevice) o;
        return id == that.id &&
                Objects.equals(userId, that.userId) &&
                Objects.equals(deviceId, that.deviceId) &&
                Objects.equals(time, that.time) &&
                Objects.equals(isBind, that.isBind) &&
                Objects.equals(extra, that.extra);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, deviceId, time, isBind, extra);
    }
}
